<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>作业</title>

    <style>
      #indicator {
        user-select: none;
        background-color: lightgray;
        padding: 4px;
      }
      #indicator > span {
        display: inline-block;
        width: 12px;
        height: 12px;
        background-color: white;
        border-radius: 50%;
      }

      #indicator > span.cur {
        background-color: #36d;
      }
    </style>
  </head>
  <body>
    <!-- HTML -> CSS -> JS -->
    <div id="indicator">
      <span class="cur"></span>
      <span></span>
      <span></span>
      <span></span>
    </div>

    <script>
      const indicator = document.getElementById('indicator')

      for (const s of indicator.children) {
        s.onmouseover = function () {
          const cur = indicator.getElementsByClassName('cur')[0]
          console.log(cur)
          cur.classList.remove('cur')

          this.classList.add('cur')
        }
      }
    </script>
  </body>
</html>
